/*
 * =====================================================================================
 *
 *       Filename:  globals.h
 *
 *    Description:  
 *
 *        Version:  0.1a
 *        Created:  17.05.2012 20:03:14
 *       Revision:  none
 *       Compiler:  g++
 *
 *         Author:  Waldemar Gorbunov, 
 *   Organization:  
 *
 * =====================================================================================
 */

#ifndef GLOBALS_H_
#define GLOBALS_H_

#include <iostream>
#include <fstream>
#include <sys/stat.h>

#include <thread>
#include <mutex>

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <signal.h>
#include <time.h>
#include <cstdio>
#include <fcntl.h>
#include <cstdlib>
#include <openssl/md5.h>

#define LOGFILE "drosera.log"

namespace Drosera {

enum CLIENTS {
	COLID,
	COLIP,
	COLUSER,
	COLPCNAME,
	COLPING
};

enum DOWNLOAD {
	COLDLID,
	COLDLFILE,
	COLDLCLIENT,
	COLDLPERC,
	COLDLSTATUS
};


struct DownloadData {
	unsigned int id;
	std::string file;
	std::string client;
	int perc;
	bool status;
};


/* regular Output messeges */
void error ( const char* );
void error ( const char*, int );
void warning ( const char* );
void warning ( const char*, int );
void info ( const char* );
void info ( const char*, int );
void writelog ( const char* );
std::string uniqueId ( unsigned short );
char **globalArgs ( char** );
void reap_child ( int );
bool fileExist ( char* );
std::string getMD5 ( char* );

}

#endif
